<#include "/inc/top.html" />
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<#include "/inc/header.html" />
</head>
<body class="theme-blue">
<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> 
<!--<![endif]-->
<#include "/inc/navbar.html" />

<div class="content">
<div class="header">
<ul class="breadcrumb">
	<li class="active">设备</li>
</ul>
</div>
<div class="main-content">
<!-- tabs -->
<ul class="nav nav-tabs">
	<li class="active"><a href="#list" data-toggle="tab">查询设备</a></li>
	<li><a href="#import" data-toggle="tab">批量导入</a></li>
</ul>
<div class="tab-content">
<div id="list" class="tab-pane active in">
<div class="panel panel-default">
<div class="panel-body">
<table id="foreignListTable" data-toggle="table" data-classes="table table-no-bordered"
       data-url="${ctx}/mgr/listForeignUUID"
       data-side-pagination="server"
       data-pagination="true"
       data-page-list="[10, 20, 50]"
       data-pagination-loop="false"
       data-search="true"
       data-show-refresh="true"
       data-query-params="DT.queryParams"
       data-response-handler="DT.responseHandler">
    <thead>
    <tr>
        <th data-field="devKey" data-width="25%">DevKey</th>
        <th data-field="uuid" data-width="40%">UUID</th>
        <th data-field="operation" 
        	data-formatter="actionFormatter"
        	data-events="actionEvents">操作
        </th>
    </tr>
    </tr>
    </thead>
</table>
</div>
</div>
</div>

<div id="import" class="tab-pane fade">
<div class="panel panel-default">
<div class="panel-body">
<form method="POST" action="${ctx}/mgr/importForeignUUID" data-success="render:#importTable" class="form-horizontal">
	<div class="alert alert-info">批量设置系统中的UUID的视频服务器为美国服务器。</div>
	<div class="alert alert-danger"></div>
	<div class="form-group">
		<label class="col-sm-1 control-label">UUID：</label>
		<div class="col-sm-6">
			<textarea name="uuids" placeholder="一行一个uuid" class="form-control" rows="5" required="required"></textarea>
		</div>
	</div>
	<div class="form-group">
		<div class="col-sm-offset-1 col-sm-4">
			<a href="javascript:void(0);" class="btn btn-primary btn-submit">导入</a>
		</div>
	</div>
</form>
<table id="importTable" class="table hide">
<thead>
<tr>
	<th>DevKey</th>
	<th>UUID</th>
	<th>错误信息</th>
</tr>
</thead>
<tbody>
<!--@each data as e-->
<tr class="?{e.msg ? 'danger' : 'success'}">
	<td>?{e.devKey}</td>
	<td>?{e.uuid}</td>
	<td>?{e.msg}</td>
</tr>
<!--@/each-->
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- tabs end!-->
</div>
</div>
<#include "/inc/script.html" />
</body>
</html>
<script type="text/javascript">

	function actionFormatter(value, row, index) {
	    return '<a class="delete">删除</a>';
	}
	//表格  - 操作 - 事件
	window.actionEvents = {
	    'click .delete' : function(e, value, row, index) {
	    	
	    	Ewin.confirm({ message: "确认要删除选择的数据吗？" }).on(function (e) {
	    		if(e)
	    		{
	    			$.ajax({
	    	    		url:'${ctx}/mgr/delForeignUUID', 
	    	    		data:{"id":row.id},
	    	    		dataType:'json',
	    	    		success:function(ret){
	    	    			if(ret && ret.code == "0")
	    	    			{
	    	    				$("#foreignListTable").bootstrapTable('refresh');
	    	    			}
	    	    			else
	    	    			{
	    	    				Ewin.alert("操作失败,服务器出错,请联系管理员！");
	    	    			}
	    	    		}
	    	    	});
	    		}
	    	});
	    	
        }
    }
</script>
